package com.aspyn.longvibrate;

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Bundle;
import android.os.Vibrator;
import android.widget.TextView;

public class LongTextMsgVibrateActivity extends Activity {
	
	//static NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        TextView tv = (TextView)findViewById(R.id.txtV);
        tv.setText("By having this app running in the background you are enabling extra long vibrate when you get texts");
    }
    
    public void setNewMessageIndicator(Context context, int messageCount){
    	   // Get the static global NotificationManager object.
    		NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);


    	   // If we're being called because a new message has been received, 
    	   // then display an icon and a count. Otherwise, delete the persistent
    	   // message.
    	   if (messageCount > 0) {
    		   Notification notif = new Notification();
    		   long[] pattern = {0L,100L,250L,1000L,250L,500L};
    		   notif.vibrate = pattern;
    		   nm.notify(0, notif);
    	      //nm.notifyWithText(LongTextMsgVibrate.NOTIFICATION_GUID,      // ID for this notification.
    	    //            messageCount + " new message" + messageCount > 1 ? "s":"", // Text to display.
    	      //          NotificationManager.LENGTH_SHORT); // Show it for a short time only.
    	   }
    	}
}